<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'home';
$return['ischecklogin']=cfc('core')->checklogin('','',true);
$this->model('member')->upmember();
$return['pluginset']['ailogo']=tomedia($return['pluginset']['ailogo']);
$return['basic']=$return['pluginset'];
if($_RQ['op']=='home'){
 
	if(!empty($_SESSION['openid'])){
		$openid = $_SESSION['openid'];
		$fansfollow=pdo_getcolumn('core_fans',array('uniacid'=>$_SESSION['uniacid'],'openid'=>$_SESSION['openid']),'follow');
	}
	$member = pdo_get('jy_aixiaoyi_member',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_SESSION['uid']));
	$member2=pdo_get('core_members',array('id'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),array('avatar','nickname'));
	$member2['avatar']=tomedia($member2['avatar']);
	$member=array_merge($member,$member2);
	$return['openid']= $_SESSION['openid'];
	$return['member']= $member;
	$return['list']= array();
	$return['sharedata']=array(
		'title'=>$return['basic']['share_title'],
		'desc'=>$return['basic']['share_desc'],
		'link'=>custom_url('jy_aixiaoyi/index//fromuser='.$_SESSION['uid'],true),
		'imgUrl'=>ATTACHMENT_URL.$return['basic']['share_image'],
	);
	set_html('title',$return['pluginset']['title']?:'AI智能聊天对话');
	exi($return);
}
if($_RQ['op']=='list'){
    
    $params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
    $pindex = max(1, intval($_RQ['page']));
	$psize = 6;
	$total = 0;
    $list=pdo_getslice('jy_aixiaoyi_mb',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
		}
	}
	$return['list']= $list;
	exi($return);
}